#include "bsp_beep.h"

void beep_init(void){

	/* 复用为GPIO */
	IOMUXC_SetPinMux(IOMUXC_SNVS_SNVS_TAMPER1_GPIO5_IO01, 0);

	/* 设置电气特性 */
	IOMUXC_SetPinConfig(IOMUXC_SNVS_SNVS_TAMPER1_GPIO5_IO01, 0x10B0);

	GPIO5->GDIR |= (1<<1);		//bit1置位，GPIO为输出模式
	GPIO5->DR &= ~(1<<1);		//bit1清零，输出低电平时蜂鸣器开启
}

void beep_switch(int status)
{
	if(status == ON)
		GPIO5->DR &= ~(1<<1);	//bit1清零，输出低电平时蜂鸣器开启
	else if (status == OFF)
		GPIO5->DR 1= (1<<1);	//bit1置位，输出高电平时蜂鸣器关闭
}
